package com.woniuxy.three.pms.comment.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.woniuxy.three.pms.bean.CommentBean;
import com.woniuxy.three.pms.comment.service.ICommentService;
import com.woniuxy.three.pms.dao.CommentMapper;

@Service
public class CommentServiceImpl implements ICommentService {

	@Autowired
	private CommentMapper dao;



	// 根据订单查询评论
	@Override
	public CommentBean findByOrderId(int id) {
		
		return dao.findByOrderId(id);
	}

	// 用户添加评论
	@Override
	public String addComment(CommentBean commentbean) {
		String mes = "添加失败";
		int a = dao.addComment(commentbean);
		if (a > 0) {
			mes = "添加成功";
		}
		return mes;
	}

	// 根据订单号去删除该订单下的评论。
	@Override
	public String delete(int order_id) {
		String mes = "删除失败";
		if (dao.delete(order_id) > 0) {
			mes = "删除成功";
		}
		return mes;
	}
	//查询该酒店所有的评论
	@Override
	public List<CommentBean> findAll() {
		List list=	dao.findAll();
		

	
		
		return list;
	}

}
